import request from '@/router/axios';

export const getFileTree = () => {
  return request({
    url: '/api/blade-filesys/fileops/treeData',
    method: 'get'

  })
}
export const uploadFile = (formData) => {
  return request({
    url: '/api/blade-filesys/fileops/upload',
    method: 'post',
    data: formData,
  })
}
export const download = (filePath) => {
  return request({
    url: '/api/blade-filesys/fileops/download',
    method: 'post',
    responseType: 'blob',
    headers:{ 'Content-Type': 'application/json; application/octet-stream'},
    params: {
      filePath,
    }
  })
}
export const downloadZip = (filePath) => {
  return request({
    url: '/api/blade-filesys/fileops/download/zip',
    method: 'post',
    responseType: 'blob',
    headers:{ 'Content-Type': 'application/json; application/octet-stream'},
    params: {
      filePath,
    }
  })
}

export const del = (filePath) => {
  return request({
    url: '/api/blade-filesys/fileops/del',
    method: 'post',
    params: {
      filePath,
    }
  })
}
export const modifyName = (filePath,name) => {
  return request({
    url: '/api/blade-filesys/fileops/modify/name',
    method: 'post',
    params: {
      filePath,
      name,
    }
  })
}
export const mkdir = (filePath,name) => {
  return request({
    url: '/api/blade-filesys/fileops/mkdir',
    method: 'post',
    params: {
      filePath,
      name,
    }
  })
}
export const mkfile = (filePath,name) => {
  return request({
    url: '/api/blade-filesys/fileops/mkfile',
    method: 'post',
    params: {
      filePath,
      name,
    }
  })
}
export const fileSharing = (filePath) => {
  return request({
    url: '/api/blade-filesys/feature/fileSharing',
    method: 'post',
    params: {
      filePath,
    }
  })
}
export const fileCooperation = (filePath) => {
  return request({
    url: '/api/blade-filesys/feature/fileCooperation',
    method: 'post',
    params: {
      filePath,
    }
  })
}

